/* Copyright (c) 2010 OFXKit
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#import <Foundation/Foundation.h>

#import "OFXAccount.h"
#import "util.h"

@interface OFXLoanAccount : OFXAccount {
  NSNumber* balanceAmount;
  NSDate*   balanceValidAsOf;
  NSNumber* balloonAmount;
  NSNumber* initialBalance;
  NSNumber* initialNumberOfPayments;
  NSNumber* interestPaidLTD;
  NSDate*   interestPaidValidAsOf;
  NSNumber* interestPaidYTD;
  NSNumber* interestRate;
  NSString* interestRateType;
  NSDate* interestRateValidAsOf;
  NSString* loanPaymentFrequency;
  NSString* loanPaymentType;
  NSString* loanType;
  NSNumber* nextPaymentAmount;
  NSDate* nextPaymentDue;
  NSNumber* nextPaymentEscrowFeesAmount;
  NSNumber* nextPaymentEscrowInsuranceAmount;
  NSNumber* nextPaymentEscrowOtherAmount;
  NSNumber* nextPaymentEscrowPMIAmount;
  NSNumber* nextPaymentEscrowTaxAmount;
  NSNumber* nextPaymentEscrowTotalAmount;
  NSDate* openingDate;
  NSNumber* principalPaidLTD; // principalPaidLoanToDate
  NSNumber* principalPaidYTD;
  NSNumber* projectedInterest;
  NSDate* projectedMaturity;
  NSNumber* remainingNumberOfPayments;  
}

/**
 * @property balanceAmount
 * @brief Current loan principal balance
 */
@property(retain) NSNumber* balanceAmount;

/**
 * @property balanceValidAsOf
 * @brief Date and time of the current loan balance.
 */
@property(retain) NSDate*   balanceValidAsOf;

/**
 * @property balloonAmount
 * @brief Not included or zero for regular loans, otherwise Balloon amount
 */
@property(retain) NSNumber* balloonAmount;

/**
 * @property initialBalance
 * @brief Initial loan balance
 */
@property(retain) NSNumber* initialBalance;

/**
 * @property initialNumberOfPayments
 * @brief Initial number of loan payments. N-5
 */
@property(retain) NSNumber* initialNumberOfPayments;

/**
 * @property interestPaidLTD
 * @brief Total interest paid to date
 */
@property(retain) NSNumber* interestPaidLTD;

/**
 * @property interestPaidValidAsOf
 * @brief Date and time of the current interest information
 */
@property(retain) NSDate*   interestPaidValidAsOf;

/**
 * @property interestPaidYTD
 * @brief Total interest paid year to date
 */
@property(retain) NSNumber* interestPaidYTD;

/**
 * @property interestRate
 * @brief Current loan interest rate
 */
@property(retain) NSNumber* interestRate;

/**
 * @property interestRateType
 * @brief Type of rate
 * 
 * One of the following: 
 * - FIXED = Fixed rate for the life of the loan 
 * - FLOATING = Floating interest rate 
 * - ARM = Adjustable rate mortgage
 */
@property(retain) NSString* interestRateType;

/**
 * @property interestRateValidAsOf
 * @brief Date and time of the current interest rate
 */
@property(retain) NSDate* interestRateValidAsOf;

/**
 * @property loanPaymentFrequency
 * @brief Frequency of payments
 *
 * One of:
 * - WEEKLY 
 * - BIWEEKLY 
 * - TWICEMONTHLY 
 * - MONTHLY 
 * - FOURWEEKS
 * - BIMONTHLY 
 * - QUARTERLY 
 * - SEMIANNUALLY 
 * - ANNUALLY 
 * - MATURITY: Payment is only due upon maturity of loan
 */
@property(retain) NSString* loanPaymentFrequency;

/**
 * @property loanPaymentType
 * @brief Type of payment
 *
 * One of the following:
 * - INTONLY = Interest only payments required 
 * - PRNANDINT = Principal and interest included in set payment 
 * - PRNPLUSINT = Principal plus accrued interest owing
 */
@property(retain) NSString* loanPaymentType;

/**
 * @property loanType
 * @brief Type of loan term
 *
 * One of:
 * - FIXED = Payments made at fixed intervals, also known as "installment" 
 * - REVOLVE = Revolving term 
 * - OPEN = Open-ended loan such as a line of credit, home equity line of 
 * credit, etc. 
 * - COMBO = Combination of above
 */
@property(retain) NSString* loanType;

/**
 * @property nextPaymentAmount
 * @brief Amount of next payment.
 */
@property(retain) NSNumber* nextPaymentAmount;

/**
 * @property nextPaymentDue
 * @brief Date next payment is due.
 */
@property(retain) NSDate* nextPaymentDue;

/**
 * @property nextPaymentEscrowFeesAmount
 * @brief Amount of fees set aside in Escrow
 */
@property(retain) NSNumber* nextPaymentEscrowFeesAmount;

/**
 * @property nextPaymentEscrowInsuranceAmount
 * @brief Amount of insurance set aside in Escrow
 */
@property(retain) NSNumber* nextPaymentEscrowInsuranceAmount;

/**
 * @property nextPaymentEscrowOtherAmount
 * @brief Amount of other amount set aside in Escrow
 */
@property(retain) NSNumber* nextPaymentEscrowOtherAmount;

/**
 * @property nextPaymentEscrowPMIAmount
 * @brief Amount of PMI set aside in Escrow
 */
@property(retain) NSNumber* nextPaymentEscrowPMIAmount;

/**
 * @property nextPaymentEscrowTaxAmount
 * @brief Amount of tax set aside in Escrow
 */
@property(retain) NSNumber* nextPaymentEscrowTaxAmount;

/**
 * @property nextPaymentEscrowTotalAmount
 * @brief Total amount of payment applied to Escrow
 */
@property(retain) NSNumber* nextPaymentEscrowTotalAmount;

/**
 * @property openingDate
 * @brief Start date of loan
 */
@property(retain) NSDate* openingDate;

/**
 * @property principalPaidLTD
 * @brief Total principal paid loan to date
 */
@property(retain) NSNumber* principalPaidLTD;

/**
 * @property principalPaidYTD
 * @brief Total principal paid year to date
 */
@property(retain) NSNumber* principalPaidYTD;

/**
 * @property projectedInterest
 * @brief Total projected interest to be paid on this loan
 */
@property(retain) NSNumber* projectedInterest;

/**
 * @property projectedMaturity
 * @brief Expected loan end date.
 */
@property(retain) NSDate* projectedMaturity;

/**
 * @property remainingNumberOfPayments
 * @brief Remaining number of payments on transaction.
 */
@property(retain) NSNumber* remainingNumberOfPayments;

@end
